package branch;

import java.util.Random;

/**
 * 测试switch语句
 */
public class SwitchDemo2 {

    public static void main(String[] args) {

        // 测试switch语句的穿透
        Random random = new Random();
        int year = random.nextInt(1, 13);   // [1,13)
        System.out.println("year = " + year);
        switch (year){
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
                System.out.println(year+"月是上半年");
                break;
            default:
                System.out.println(year+"月是下半年");
        }


        String computer = "华为";

        switch (computer){
            case "华为":
                System.out.println("华为牛逼！！！");
                break;
            case "联想" :
                System.out.println("世界没有联想，将会怎样！");
                break;
            default:
                System.out.println("其他品牌");

        }






    }
}
